// rgObject.cpp

#include "../../include/kernel/rgObject.h"

/*
inline rgRay reflect(const rgVector& inPoint, const rgRay& inRay)
{
	rgRay result; // the reflected ray

	
	Vector result_direction; // the reflected direction vector
	Vector incident_unit = rIncidentRay.Direction().Normalize();
	Vector normal = this->Normal(rReflectFrom, rIncidentRay.Origin() );
	if ( !normal.IsSameDirection(incident_unit) )
		normal.ReverseDirection(); // we want the normal in the same direction of the incident ray.

	result.Origin(rReflectFrom);
	result.Direction( normal*2.0*normal.Dot(incident_unit) - incident_unit );
	
	return result;
}
*/

/*
rgVector rgObject::normal(rgVector hitPoint)
{
	switch(defaultPrimitive)
	{
		case OBJECT_SPHERE:
			return rgVector( (hitPoint - this->position) / rgSphere::radius );
		break;

		case OBJECT_TRIANGLE:
			return rgTriangle::normal;
		break;
	}
	
	return rgVector::vZero;
}
*/

/*
float rgObject::radius(rgVector inCenter)
{
	float dMax, dThis;
	int i;
	rgVector dummy;

	if (defaultPrimitive == OBJECT_SPHERE) return rgSphere::radius;

	dMax = 0.0;

	if (defaultPrimitive == OBJECT_TRIANGLE)
	{
		for(i = 0; i < 3; ++i)
		{
			dummy = vertex[i] - inCenter;
			dThis = dummy.mag();
			if(dThis > dMax) dMax = dThis;
		}
	}

	return dMax;
}
*/